package com.liang.paul.officelite.activities;

import android.content.Intent;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

import com.liang.paul.officelite.R;
import com.liang.paul.officelite.fragments.FileFragment;
import com.liang.paul.officelite.fragments.MainPageFragment;
import com.liang.paul.officelite.fragments.TaskFragment;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems;

public class TeamDetailActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_team_detail);
        Intent intent = getIntent();
        //Toast.makeText(this, intent.getStringExtra("teamId"), Toast.LENGTH_SHORT).show();

        Bundle bundle = new Bundle();
        bundle.putString("teamId", intent.getStringExtra("teamId"));

        FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
                getSupportFragmentManager(), FragmentPagerItems.with(this)
                .add("Main", MainPageFragment.class, bundle)
                .add("Task", TaskFragment.class, bundle)
                .add("File", FileFragment.class, bundle)
                .create());

        ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
        viewPager.setAdapter(adapter);

        SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
        viewPagerTab.setViewPager(viewPager);
    }
}
